import perfectionist from 'eslint-plugin-perfectionist';

export function perfectionistConfig() {
  return [
    perfectionist.configs['recommended-natural'],
    {
      rules: {
        'perfectionist/sort-interfaces': ['error'],
        // 对象的属性长度排序
        'perfectionist/sort-objects': [
          'error',
          {
            fallbackSort: { order: 'asc', type: 'alphabetical' },
            type: 'alphabetical',
          },
        ],
        // 数组include方法使用长度排序
        'perfectionist/sort-array-includes': [
          'error',
          {
            order: 'asc',
            type: 'alphabetical',
            // 长度相同的按照首字母排序
            fallbackSort: { order: 'asc', type: 'alphabetical' },
          },
        ],
      },
      settings: {
        perfectionist: {
          partitionByComment: true,
          type: 'line-length',
        },
      },
    },
  ];
}
